'use strict';
const {getDefaultModelConfig} = require("../../utils/common");
// 供应商表
module.exports = app => {
    const { STRING, INTEGER, BIGINT, TEXT } = app.Sequelize;
    return app.model.define(
        'Supplier',
        {
            id: { type: BIGINT, primaryKey: true, autoIncrement: true },
            name: { type: STRING(255), allowNull: false, comment: '供应商名称' },
            username: { type: STRING(100), allowNull: false, unique: true, comment: '登录用户名' },
            password: { type: STRING(255), allowNull: false, comment: '登录密码' },
            contact_person: { type: STRING(100), allowNull: false, comment: '联系人' },
            phone: { type: STRING(20), allowNull: false, comment: '联系电话' },
            address: { type: TEXT, comment: '地址' },
            business_license: { type: STRING(255), comment: '营业执照号' },
            status: { type: INTEGER, defaultValue: 1, comment: '状态 1:正常 0:禁用' },
            ...getDefaultModelConfig(app)
        },
        {
            tableName: 'supplier',
            timestamps: true,
            createdAt: 'create_time',
            updatedAt: 'update_time'
        }
    );
}; 